home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softdisk Supreme
/
Softdisk Supreme.iso
/
pc
/
DSK Files
/
0-49
/
SD006b.dsk
/
MASTERMIND.bas
< prev
next >
Wrap
BASIC Source File
|
2003-06-12
|
3KB
|
88 lines
1 REM **************************
2 REM MASTERMIND BY D.CAICEDO
3 REM **************************
10 N = 4
20 A$(1) = "MASTERMIND":A$(2) = " BY":A$(3) = "D.CAICEDO"
30 HOME : FOR R = 1 TO N -1:A$ = A$(R)
40 A = LEN(A$): IF INT(A/2) = A/2 GOTO 60
50 A$ = A$ +" ":A = LEN(A$)
60 H = A/2: SPEED= 200
70 FOR X = 1 TO H: VTAB R: PRINT MID$ (A$,1,X): NEXT X
80 FOR Y = 1 TO (20 -H): VTAB R: HTAB Y: PRINT " " + LEFT$(A$,H): NEXT Y
90 FOR V = 1 TO (20 -H): VTAB R: HTAB (41 -H -V): PRINT RIGHT$(A$,H) +" ": NEXT V
100 NEXT R: SPEED= 255: VTAB 20
110 N = 0
120 DIM G$(4,50),F$(4,50),W(50),V(50),CL(4,50)
130 DIM C$(6):C$(1) = "M":C$(2) = "B":C$(3) = "V":C$(4) = "W":C$(0) = "O"
140 C$(5) = "G":C$(6) = "T"
150 FOR J = 0 TO 4
160 X = INT(6 * RND(J) +.5)
170 D$(J) = C$(X)
180 NEXT
190 PRINT "THE OBJECT OF THE GAME IS TO"
191 PRINT "GUESS A SEQUENCE OF FIVE COLORS AS "
192 PRINT "SELECTED BY THE COMPUTER"
200 PRINT
210 PRINT "COLOR CODES:"
211 PRINT
220 PRINT "G=GREEN,T=TAN,W=WHITE,B=BLUE"
230 PRINT "O=ORANGE,V=VIOLET,M=MAGENTA"
240 PRINT "Z=QUIT AND SEE ANSWER"
241 PRINT "RERUN TO START NEW GAME"
250 PRINT "YELLOW BOXES SHOW NUMBER OF CORRECT"
260 PRINT "COLORS;WHITE BOXES SHOW NUMBER"
270 PRINT "OF CORRECT COLORS IN CORRECT POSITION"
271 PRINT
281 PRINT "INPUT 5 COLOR CODES"
290 FOR I = 0 TO 4: INPUT A$:G$(I,N) = A$:F$(I,N) = A$: GOSUB 580: NEXT : GOSUB 700
299 PRINT "INPUT 5 COLOR CODES"
300 ONERR GOTO 750
310 COUNT = 0
320 FOR I = 0 TO 4
330 IF G$(I,N) = D$(I) THEN COUNT = COUNT +1
340 NEXT
350 W(N) = COUNT
360 FOR J = 0 TO N
370 FOR I = 0 TO 4
380 AB = 0
390 GOSUB 460
400 IF AB THEN CR = CR +1
410 NEXT
420 V(N) = CR
430 GOSUB 500
440 N = N +1:CR = 0
450 GOTO 290:CR = 0
460 FOR K = 0 TO 4
470 IF D$(I) = G$(K,N) THEN AB = 1:G$(K,N) = "S": GOTO 490
480 NEXT
490 RETURN
500 FOR M = 0 TO N
510 FOR K = 0 TO 4:X$ = F$(K,M): GOSUB 620
520 CL(K,M) = XI: NEXT : NEXT
530 GR : FOR M = 0 TO N
540 FOR K = 0 TO 4: COLOR= CL(K,M): PLOT 10 +2 *K,35 -M *2: NEXT
550 COLOR= 10: IF V(M) > <0 THEN FOR Q = 1 TO V(M): PLOT 19 +2 *Q,35 -2 *M: NEXT : COLOR= 11
560 IF W(M) < >0 THEN FOR R = 1 TO W(M): PLOT 29 +2 *R,35 -2 *M: NEXT
570 NEXT : RETURN
580 IF A$ = "Z" THEN TEXT : PRINT "THE ANSWERWAS:";: FOR I = 0 TO 4: PRINT D$(I);: NEXT
581 PRINT
590 RETURN
600 PRINT
610 END
620 IF X$ = "T" THEN XI = 8
630 IF X$ = "G" THEN XI = 4
640 IF X$ = "O" THEN XI = 9
650 IF X$ = "M" THEN XI = 1
660 IF X$ = "V" THEN XI = 3
670 IF X$ = "B" THEN XI = 2
680 IF X$ = "W" THEN XI = 15
690 RETURN
700 GOSUB 500
710 IF A$ = "Z" THEN RETURN
711 PRINT "INPUT Y TO ACCEPT OR"
712 PRINT "N IF YOU CHANGED YOUR MIND"
713 INPUT Z$
720 IF Z$ = "Y" THEN CALL -912: CALL -912: CALL -912: RETURN
730 POP
740 GOTO 290
750 GOTO 310